﻿using Castle.ActiveRecord;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TES.Domain
{
    /// <summary>
    /// 班级
    /// </summary>
    [ActiveRecord("Classes")]
    public class Classes:EntityBase
    {
        /// <summary>
        /// 班级名称
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Required(ErrorMessage = "不能为空")]
        [StringLength(50, ErrorMessage = "不能超过50个字符")]
        [Display(Name = "班级名称")]
        public virtual string ClassName { get; set; }

        /// <summary>
        /// 班级代码
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Required(ErrorMessage = "不能为空")]
        [StringLength(50, ErrorMessage = "不能超过50个字符")]
        [Display(Name = "班级代码")]
        public virtual string ClassNumber { get; set; }

        /// <summary>
        /// 所属系部
        /// </summary>
        [BelongsTo(Type = typeof(Department),
              Column = "DepartmentID",
              NotNull = false,
              Cascade = CascadeEnum.None,
              Lazy = FetchWhen.OnInvoke)]
        [Display(Name = "系部")]
        public virtual Department Department { get; set; }

    }

}

